Optimal. Leaf size=86 \[ a^2 B x+\frac {\left (4 a b B+2 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b (2 b B+3 a C) \tan (c+d x)}{2 d}+\frac {b C (a+b \sec (c+d x)) \tan (c+d x)}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.11, antiderivative size = 86, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 38, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.132, Rules used = {4157, 4003,
3855, 3852, 8} \begin {gather*} \frac {\left (2 a^2 C+4 a b B+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+a^2 B x+\frac {b (3 a C+2 b B) \tan (c+d x)}{2 d}+\frac {b C \tan (c+d x) (a+b \sec (c+d x))}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 4003
Rule 4157
Rubi steps
\begin {align*} \int \cos (c+d x) (a+b \sec (c+d x))^2 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx &=\int (a+b \sec (c+d x))^2 (B+C \sec (c+d x)) \, dx\\ &=\frac {b C (a+b \sec (c+d x)) \tan (c+d x)}{2 d}+\frac {1}{2} \int \left (2 a^2 B+\left (4 a b B+2 a^2 C+b^2 C\right ) \sec (c+d x)+b (2 b B+3 a C) \sec ^2(c+d x)\right ) \, dx\\ &=a^2 B x+\frac {b C (a+b \sec (c+d x)) \tan (c+d x)}{2 d}+\frac {1}{2} (b (2 b B+3 a C)) \int \sec ^2(c+d x) \, dx+\frac {1}{2} \left (4 a b B+2 a^2 C+b^2 C\right ) \int \sec (c+d x) \, dx\\ &=a^2 B x+\frac {\left (4 a b B+2 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b C (a+b \sec (c+d x)) \tan (c+d x)}{2 d}-\frac {(b (2 b B+3 a C)) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{2 d}\\ &=a^2 B x+\frac {\left (4 a b B+2 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b (2 b B+3 a C) \tan (c+d x)}{2 d}+\frac {b C (a+b \sec (c+d x)) \tan (c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.29, size = 67, normalized size = 0.78 \begin {gather*} \frac {2 a^2 B d x+\left (4 a b B+2 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))+b (2 b B+4 a C+b C \sec (c+d x)) \tan (c+d x)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.10, size = 112, normalized size = 1.30
method | result | size |
derivativedivides | \(\frac {b^{2} B \tan \left (d x +c \right )+b^{2} C \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+2 a b B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 a b C \tan \left (d x +c \right )+a^{2} B \left (d x +c \right )+a^{2} C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) | \(112\) |
default | \(\frac {b^{2} B \tan \left (d x +c \right )+b^{2} C \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+2 a b B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 a b C \tan \left (d x +c \right )+a^{2} B \left (d x +c \right )+a^{2} C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) | \(112\) |
risch | \(a^{2} B x -\frac {i b \left (C b \,{\mathrm e}^{3 i \left (d x +c \right )}-2 B b \,{\mathrm e}^{2 i \left (d x +c \right )}-4 C a \,{\mathrm e}^{2 i \left (d x +c \right )}-C b \,{\mathrm e}^{i \left (d x +c \right )}-2 b B -4 a C \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a b B}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a^{2} C}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{2} C}{2 d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a b B}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a^{2} C}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{2} C}{2 d}\) | \(217\) |
norman | \(\frac {a^{2} B x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {b \left (2 b B +4 a C -C b \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {b \left (2 b B +4 a C +C b \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-a^{2} B x +2 a^{2} B x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-2 a^{2} B x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {b \left (2 b B +4 a C -C b \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {b \left (2 b B +4 a C +C b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}-\frac {\left (4 a b B +2 a^{2} C +b^{2} C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {\left (4 a b B +2 a^{2} C +b^{2} C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) | \(276\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.30, size = 140, normalized size = 1.63 \begin {gather*} \frac {4 \, {\left (d x + c\right )} B a^{2} - C b^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 2 \, C a^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 8 \, C a b \tan \left (d x + c\right ) + 4 \, B b^{2} \tan \left (d x + c\right )}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.27, size = 136, normalized size = 1.58 \begin {gather*} \frac {4 \, B a^{2} d x \cos \left (d x + c\right )^{2} + {\left (2 \, C a^{2} + 4 \, B a b + C b^{2}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (2 \, C a^{2} + 4 \, B a b + C b^{2}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (C b^{2} + 2 \, {\left (2 \, C a b + B b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (B + C \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{2} \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 192 vs.
\(2 (80) = 160\).
time = 0.51, size = 192, normalized size = 2.23 \begin {gather*} \frac {2 \, {\left (d x + c\right )} B a^{2} + {\left (2 \, C a^{2} + 4 \, B a b + C b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (2 \, C a^{2} + 4 \, B a b + C b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (4 \, C a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, C a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.48, size = 176, normalized size = 2.05 \begin {gather*} \frac {2\,\left (B\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+C\,a^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+\frac {C\,b^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}+2\,B\,a\,b\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\right )}{d}+\frac {\frac {B\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{2}+\frac {C\,b^2\,\sin \left (c+d\,x\right )}{2}+C\,a\,b\,\sin \left (2\,c+2\,d\,x\right )}{d\,\left (\frac {\cos \left (2\,c+2\,d\,x\right )}{2}+\frac {1}{2}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________